#! /usr/bin/python3
# coding=utf-8
# @Time: 2022/8/11 10:24 PM
# @Author: william

from selenium.webdriver.common.by import By

from base.HomeBasse import HomeBase
from base.ObjectMap import ObjectMap


class HomePage(HomeBase, ObjectMap):
    def get_balance(self, driver):
        """
        获取首页的账户余额
        :param driver:
        :return:
        """
        balance_xpath = self.user_balance()
        return self.element_get(driver, By.XPATH, balance_xpath).text

    def logout(self, driver):
        """
        退出登录
        :param driver:
        :return:
        """
        avatar_head_xpath = self.home_user_avatar_head()
        self.move_to(driver, By.XPATH, avatar_head_xpath)
        logout_xpath = self.dropdown_munu("退出登录")
        self.element_click(driver,By.XPATH,logout_xpath)
